<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Pragma" content="no-cache" />
		<title>条码管理</title>
		<%@ include file="/user_comm.jsp"%>
		<link rel="stylesheet"
			href="http://a.tbcdn.cn/apps/sell/1.0/publish_detail_ke.css?t=20110128editor.css" />
		<link href="<%=request.getContextPath()%>/css/prop.css"
			type="text/css" rel="stylesheet" />
		<!-- script start -->
		<script>
 // --列头全选框被单击---
	function ChkAllClick(sonName, cbAllId){
	    var arrSon = document.getElementsByName(sonName);
	 	var cbAll = document.getElementById(cbAllId);
	 	var tempState=cbAll.checked;
	 	for(i=0;i<arrSon.length;i++) {
	  	if(arrSon[i].checked!=tempState)
	        arrSon[i].click();
	 	}
	}
	
	// --子项复选框被单击---
	function ChkSonClick(sonName, cbAllId) {
	 	var arrSon = document.getElementsByName(sonName);
	 	var cbAll = document.getElementById(cbAllId);
	 	for(var i=0; i<arrSon.length; i++) {
	     	if(!arrSon[i].checked) {
	     		cbAll.checked = false;
	     		return;
	    	}
	 	}
	 	cbAll.checked = true;
	}
	
	function statusChange(status){
		checkSubmit("0");
	}
	
	function checkSubmit(opertype){
		var selIds = checkboxvalue("chkSon");
		$d("hdfOpertype").value=opertype;
		$d("hdfIds").value=selIds;
		var form=document.getElementById("formpage");
		if(opertype=="0"){
			form.action="validate_createBarcode.do";
			form.submit();
			return true;
		}if(opertype=="1"){
			form.action="validate_listAllBarcode.do";
			form.submit();
			return true;
		}else{
			if(selIds==""){
				if(opertype=="3")
					alert("请选择要作废的条码！");
				return false;
			}
			//1-分配，2-回收，3-作废
			 if(opertype=="3"){
				var txt='确定要作废选中的条码吗?<br/><font color="red">作废后将无法恢复使用</font>';
				$.prompt(txt,{
					submit: mycallback23,
					buttons: { 确定: true, 取消: false }
				});
			}
		}
		return true;
	}
	
	//--------------弹出对话框-----------------
	function mycallback23(v,m,f){
		if(v==true){
			var form=$d("formpage");
			form.action="validate_exec2.do";
			form.submit();
		}
	}
</script>
		<!-- script end -->
	</head>
	<body>
		<div class="realCer">
			<!--导航-->
			<!--主体部分start-->
			<div class="realMain clearfix mt10">
				<div class="realRight ml10 Buyer">
					<div class="mybox">
						<div class="mytit">
							条码管理
						</div>
						<div class="con Orbuy">
							<s:form name="formpage" action="validate_listAllBarcode" namespace="/">
								<%@ include file="/messages.jsp"%>
								<s:token></s:token>
								<div class="pCenter">
									<div class="search_bcontrol">
												生成个数：
											<input id="count" name="count" maxlength="10"
												value="${count}" size="12" type="text" />
											&nbsp;<button type="button" class="J_MakePoint btn search-btn"
												onclick="return checkSubmit('0');">
												生成
											</button>
									</div>
									<div class="mytit">
									</div>
									<div>
										<div class="search_bcontrol">
												序列号：
											<input id="seqId" name="validateDto.seqId" maxlength="20"
												value="${validateDto.seqId}" size="30" type="text" />
											<button type="button" class="J_MakePoint btn search-btn"
												onclick="return checkSubmit('1');">
												搜索
											</button>
											<a class="at_but b_2_g" href="#"
												onclick="return checkSubmit('3');"><u></u>作废</a>
												
										</div>
									</div>
									<s:hidden id="hdfIds" name="ids" />
									<s:hidden id="hdfOpertype" name="opertype" />
									<s:hidden id="hdfOwnerId" name="ownerId" />

									<table class="favorRwList mt5">
										<tr>
											<th class="title" width="40">
												<input id='chkAll' name='chkAll' type='checkbox'
													onclick="ChkAllClick('chkSon','chkAll')" />
											</th>
											<th class="title">
													序列号
											</th>
											<th class="title">
													所属公司
											</th>
											<th class="title">
												状态
											</th>
										</tr>
										<s:iterator value="#request.validList" id="ca">
											<tr>
												<td align="center" width="40">
													<s:if test='"01"==#ca.status || "00"==#ca.status'>
														<input name="chkSon" type="checkbox"
															value='<s:property value="#ca.id" />'
															onclick="ChkSonClick('chkSon','chkAll')" />
													</s:if>
													<s:else>
														<input name="chkSon" type="checkbox"
															value='<s:property value="#ca.id" />' disabled="disabled" />
													</s:else>
												</td>
												<td>
													<s:property value="#ca.seqId" />
												</td>
												<td>
													<s:property value="#ca.companyId" />
												</td>
												<!-- 01：未激活、02：已激活、03：已验证、04：业务单关闭、05:已冻结 、06: 已作废 -->
												<td>
													<s:if test='"01"==#ca.status'>未激活</s:if>
													<s:elseif test='"02"==#ca.status'>已激活</s:elseif>
													<s:elseif test='"03"==#ca.status'>已验证</s:elseif>
													<s:elseif test='"04"==#ca.status'>业务单关闭</s:elseif>
													<s:elseif test='"05"==#ca.status'>已冻结</s:elseif>
													<s:elseif test='"06"==#ca.status'>已作废</s:elseif>
													<s:elseif test='"00"==#ca.status'>已屏障</s:elseif>
													<s:else>
														<s:property value="#ca.status" />
													</s:else>
												</td>
											</tr>
										</s:iterator>
										<s:if test="#request.validList.size()==0">
											<tr>
												<td colspan="4">
													<span class='orange1 ml5'>没有满足条件的记录</span>
												</td>
											</tr>
										</s:if>
									</table>
									<s:property value="#request.allowpage" escape="false" />
								</div>
							</s:form>
						</div>
					</div>
				</div>
				<!--主体部分end-->
			</div>
		</div>
		<!--底部 start-->
		<%@ include file="/user_button.jsp"%>
		<!--底部end-->
	</body>
</html>
